<?php
declare (strict_types = 1);

namespace app\admin\controller;

use app\BaseController;
use think\facade\Db;

class Service extends BaseController
{
    public function index()
    {

        return $this->success(Db::table('service')->order('id','desc')->paginate(10));
    }


    public function create()
    {
        $params= request()->param();
        $params['created_at']=time();
        return $this->success(Db::table('service')->insert($params));
    }


    public function update($id)
    {

        return $this->success(Db::table('service')->where('id',$id)->update(request()->param()));
    }


    public function delete($id)
    {
        return $this->success(Db::table('service')->where('id',$id)->delete());
    }
}
